public class ShellSort {
   public static void shellSwapSort(int[] arr){
       int count=0;
       System.out.println("希尔排序");
       int gap= arr.length/2;
       while (gap>0){
           for(int i=gap;i<arr.length;i++){
               int index=i;
               while (index-gap>=0&&arr[index-gap]>arr[index]){
                     utils.swap(arr,index-gap,index);
                     index-=gap;
                     count++;
               }
           }
           gap/=2;
       }
       System.out.println(count);
   }
    public static void shellMoveSort(int[] arr){
        System.out.println("希尔排序");
        int gap= arr.length/2;
        while (gap>0){
            for(int i=gap;i<arr.length;i++){
                int temp=arr[i];
                int index=i-gap;
                while (index>=0&&arr[index]>temp){

                   arr[index+gap]=arr[index];
                    index-=gap;
                }
               arr[index+gap]=temp;
            }
            gap/=2;
        }
    }
}

